#include <iostream>

#include <thrift/concurrency/TimerManager.h>
#include <thrift/concurrency/PlatformThreadFactory.h>
using namespace std;
using namespace boost;
using namespace apache::thrift;
// using namespace apache::thrift::concurrency;

class TestTask : public concurrency::Runnable {
 public:
  virtual void run() {
    cout << "run ok." << endl;
  }
};


int main() {
  concurrency::TimerManager tm;

  shared_ptr<concurrency::PlatformThreadFactory> factory = shared_ptr<concurrency::PlatformThreadFactory>(new concurrency::PlatformThreadFactory());
  tm.threadFactory(factory);

  tm.start();

  tm.add(shared_ptr<concurrency::Runnable>(new TestTask()), 2000);
  cout << "taskCount : " << tm.taskCount() << endl;
  cout << "state : " << tm.state() << endl;

  sleep(10);

  tm.stop();
  return 0;
}

